<?php
/**
 * Created by PhpStorm.
 * User: user
 * Date: 2019/10/15
 * Time: 9:55
 */
//
//
//global $objC;
//$userID = 4006307;
//$data = array(
//    "times"=>2
//);
//$sql = 'SELECT userID FROM tbl_activity_sdgift_dtails WHERE userID = '.$userID;
//$userInfo = $objC->getRow($sql);
//if(!$userInfo)
//{
//    return false;//没有参与
//}
//$sql = "select task4,bindUser,welfareTaskNum from tbl_activity_sdgift_dtails where userID = ".$userID;
//$task1 = $objC->getRow($sql);
////如果是第一次完成任务给自己的推荐人+1,对应礼包且任务完成状态为1
//if(($task1['welfareTaskNum'] + $data['times']) > 2 && $task1['task4'] != 1){
//    $objC->begin();
//    $res = publicUpdateOne("tbl_activity_sdgift_dtails",array("mTime"=>time(),"task1"=>1,"welfareTaskNum"=>"+".$data['times']),array("userID"=>$userID));
//    if($res['error'] > 10000){
//        $objC->back();
//        return false;
//    }
//    $res = publicUpdateOne("tbl_activity_sdgift",array("mTime"=>time(),"gameNum"=>"+1"),array("userID"=>$task1['bindUser']));
//    if($res['error'] > 10000){
//        $objC->back();
//        return false;
//    }
//    $objC->commit();
//    return true;
//}
////否则只加完成次数
//else{
//    $res = publicUpdateOne("tbl_activity_sdgift_dtails",array("welfareTaskNum"=>$data['times']),array("userID"=>$userID));
//    if($res['error'] > 10000){
//        return false;
//    }
//    return true;
//}
//$actType = 'signin';
//$actTurn[$actType] = 1;
//if ($actTurn[$actType]) {
//    include_once $WWW_PATH.'activities/hook/'.$actType.'.php';
//    if (class_exists($actType)) {
//        $actObj = $actType::getObj();
//        echo "<pre>";
//        print_r($actObj->run());
////        $arr = array(
////            'userID'  => 4006307,
////            'userNick'=> "hi",
////            'surplusG'=> 200,
////            'randomG' => 10,
////            'gamesG'  => floor($arrSignin['gamesG']*0.01),
////            'dayG'	  => 10,
////        );
////        if(!$actObj->run($arr)){
////            $objC->back();
////            echo ajaxReturn(array('error'=>10002,'msg'=>transcode("抱歉，签到失败2！",2)));
////            exit();
////        }
//    }
//}


//echo date("Y-m-d H:i:s",strtotime(date("Y-m-d",1571807481))+60*60*24);

//$userID = 4006307;
//
//$sql = 'SELECT userID FROM tbl_activity_sdgift_dtails WHERE userID = '.$userID;
//$userInfo = $objC->getRow($sql);
//if(!$userInfo)
//{
//    echo 1122;//没有参与
//    die;
//}
//$bindUserIDSql = "select bindUser,task2,taskNum2,lastSign from tbl_activity_sdgift_dtails where userID = {$userID}";
//$bindUserID = $objC->getRow($bindUserIDSql);
////连续签到
//if($bindUserID){
//    if(time() - $bindUserID['lastSign'] < 86400){
//        $sql = publicUpdateOne("tbl_activity_sdgift_dtails",array('mTime'=>time(),"taskNum2"=>"+1","evenSign"=>"+1","lastSign"=>time()),array("userID"=>$userID));
//        if($sql['error'] > 10000){
//            echo 1;die;
//        }
//    }else{
//        $sql = publicUpdateOne("tbl_activity_sdgift_dtails",array('mTime'=>time(),"taskNum2"=>"+1","evenSign"=>0,"lastSign"=>time()),array("userID"=>$userID));
//        if($sql['error'] > 10000){
//            echo 2;die;
//        }
//    }
//}
////连续签到三天
//if($bindUserID['taskNum2']+1 == 3 && $bindUserID['bindUser']){
//    $sql = publicUpdateOne("tbl_activity_sdgift",array("mTime"=>time(),"signNum"=>"+1"),array("userID"=>$bindUserID));
//    if($sql['error'] > 10000){
//        echo 3;die;
//    }
//}


?>
<!--//echo md5(md5(12345));die;-->
<!--//$n = 1;-->
<!--//$m = 100;-->
<!--//echo "<pre>";-->
<!--//print_r(evenSum($n,$m));-->
<!--//-->
<!--//function evenSum($n,$m){-->
<!--//    if(!is_numeric($n) || !is_numeric($m)){-->
<!--//        echo "参数错误";-->
<!--//        exit();-->
<!--//    }-->
<!--//    $evenArr = array();-->
<!--//    for ($i = $n;$i < $m;$i++){-->
<!--//        if($i%2 == 0){-->
<!--//            $evenArr[] = $i;-->
<!--//        }-->
<!--//    }-->
<!--//    return $evenArr;-->
<!--//}-->

<!--<!doctype html>-->
<!--<html lang="en">-->
<!--<head>-->
<!--    <meta charset="UTF-8">-->
<!--    <meta name="viewport"-->
<!--          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">-->
<!--    <meta http-equiv="X-UA-Compatible" content="ie=edge">-->
<!--    <title>Document</title>-->
<!--</head>-->
<!--<style>-->
<!--    /*一个loading动画*/-->
<!--    /*@keyframes规则*/-->
<!--    @keyframes pageLoading{     /*用“0%-100%”或者“from-to”都可以*/-->
<!--        from{-->
<!--            width: 0px;height: 0px; opacity: 1;      /*渐变改变宽度和高度，并且设置opacity,使颜色越来越淡*/-->
<!--        }-->
<!--        to{-->
<!--            width: 100px;height: 100px;opacity: 0;-->
<!--        }-->
<!--    }-->
<!--    /*画一个页面居中的圆形*/-->
<!--    .loading{-->
<!--        width: 400px;-->
<!--        height: 400px;-->
<!--        position: relative;-->
<!--    }-->
<!--    .loading:before,-->
<!--    .loading:after {-->
<!--        position: absolute;      /*一定要绝对定位，不然不会出现*/-->
<!--        content: '';-->
<!--        width: 0px;-->
<!--        height: 0px;-->
<!--        border-radius: 50%;-->
<!--        top: 0;bottom: 0;left: 0;right: 0;margin:auto;  /*元素页面居中，一定要将上下左右的值设置为0*/-->
<!--        background: rgb(71, 71, 71);-->
<!--        animation: pageLoading 1s linear infinite;   /*动画渐变变大，linear infinite让动画不断渐变不要停*/-->
<!--    }-->
<!--    /*现在我们需要让后一个圆比前一个圆后渐变*/-->
<!--    .loading:after{-->
<!--        animation-delay: 0.5s;-->
<!--    }-->
<!--</style>-->
<!--<body>-->
<!-- <div class="loading">-->
<!---->
<!-- </div>-->
<!--</body>-->
<!--</html>-->

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
    <title>Document</title>
</head>
<body>


<span id="time_h"></span>
<span id="time_m"></span>
<span id="time_s"></span>

<script src="https://code.jquery.com/jquery-3.1.1.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    $(function(){
        show_time();
    });
    function show_time() {
        var time_start = new Date().getTime(); //设定当前时间
        var time_end = new Date("2019/10/25 17:30:00").getTime(); //设定目标时间
        // 计算时间差
        var time_distance = time_end - time_start;
        // 天
        var int_day = Math.floor(time_distance / 86400000)
        time_distance -= int_day * 86400000;
        // 时
        var int_hour = Math.floor(time_distance / 3600000)
        time_distance -= int_hour * 3600000;
        // 分
        var int_minute = Math.floor(time_distance / 60000)
        time_distance -= int_minute * 60000;
        // 秒
        var int_second = Math.floor(time_distance / 1000)
        // 时分秒为单数时、前面加零
        if (int_day < 10) {
            int_day = "0" + int_day;
        }
        if (int_hour < 10) {
            int_hour = "0" + int_hour;
        }
        if (int_minute < 10) {
            int_minute = "0" + int_minute;
        }
        if (int_second < 10) {
            int_second = "0" + int_second;
        }
        // 显示时间
        $("#time_d").html(int_day);
        $("#time_h").html(int_hour+"时");
        $("#time_m").html(int_minute+"分");
        $("#time_s").html(int_second+"秒");
        // 设置定时器
        setTimeout("show_time()", 1000);
    }

</script>
</body>
</html>
